time and space complexity in toc